package com.kim.smartring.db.dao;

import java.util.List;

import android.content.Context;

import com.kim.smartring.db.model.HeartRateRecord;
import com.kim.smartring.utils.DateUtils;

public class HearRateRecordDao extends BaseDao<HeartRateRecord, String> {

	public HearRateRecordDao(Context context) {
		super(context);
	}

	public List<HeartRateRecord> getUnSyncHeartRateRecords() {
		String strWhere = " hTime < " + DateUtils.getCurrentDayStartTime()
				+ " and hSyncState=0";
		return findAllByWhere(HeartRateRecord.class, strWhere);
	}

	public void updateSyncState(List<HeartRateRecord> heartRateRecords) {
		if (heartRateRecords == null || heartRateRecords.size() == 0) {
			return;
		}
		for (HeartRateRecord record : heartRateRecords) {
			record.sethSyncState(1);
			update(record);
		}
	}
}
